package day06;
import java.util.Arrays;
import java.util.Scanner;
/**
 * 猜数字小游戏
 * 训练目标：while (ture)，自造死循环
 */
public class Guessing {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = (int)(Math.random()*1000+1);
        System.out.println(num);
        System.out.println("猜个数");
        while (true){//猜个数
            System.out.println("猜吧");
            int guess= scan.nextInt();
            if(guess>num){
                System.out.println("猜大了");
            }else if(guess<num){
                System.out.println("猜小了");
            }else {
                System.out.println("猜对了！牛逼！");
                break;//跳出死循环，无此语句则一直死循环
            }

        }
    }
}
